package org.ellwood.framework.common.result;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @BelongsProject: ellwood-pro
 * @BelongsPackage: org.ellwood.framework.common.utils
 * @BelongsClass: PageResult
 * @Description: // 分页工具类
 * @Author: ellwood
 * @CreateTime: 2024/1/30 - 16:15
 * @Version: V1.0.0
 */
@Data
@Schema(description = "分页工具类")
public class PageResult<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "总记录数")
    private int total;

    @Schema(description = "列表数据")
    private List<T> result;

    /**
     * 分页
     * @param result 列表数据
     * @param total 总记录数
     */
    public PageResult(List<T> result, long total){
        this.result = result;
        this.total = (int) total;
    }

}
